// collapsing/expanding box
var sliderHeight = "100";
$(document).ready(
    function(){
    $('.collapseable_box').each(
        function () {
            var current = $(this);
            current.attr("box_h", current.height());
            if(current.height()>sliderHeight) {
                current.css("height", sliderHeight);
                current.parent().find(".read-more").html('<a>More</a>');
                current.parent().find(".read-more a").click(
                    function() { openSlider(current) })
            }
        });
    }
);
function openSlider(ojnow)
{
    var open_height = ojnow.attr("box_h") + "px";
    ojnow.animate({"height": open_height}, {duration: "slow" });
    ojnow.parent().children(".read-more").html('<a>Less</a>');
    ojnow.children("#gradient").fadeOut();
    ojnow.parent().children(".read-more").children().click(
        function() { closeSlider(ojnow) })
}
function closeSlider(ojnow)
{
    ojnow.animate({"height": sliderHeight}, {duration: "slow" });
    ojnow.parent().children(".read-more").html('<a>More</a>');
    ojnow.children("#gradient").fadeIn();
    ojnow.parent().children(".read-more").children().click(
        function() { openSlider(ojnow) })
}

// slideshow
function slideShow() {
    var $active = $('#s_show DIV.active');
    if ($active.length == 0) $active = $('#s_show DIV:last');
    var $next = $active.next().length ? $active.next()
    : $('#s_show DIV:first');
    $active.addClass('last-active');
    $next.css({ opacity: 0.0 })
    .addClass('active')
    .animate({ opacity: 1.0 }, 1000, function () {
        $active.removeClass('active last-active');
    });
}

$(function () {
    setInterval("slideShow()", 3000);
});